//统一定义路由功能

//1、加载路由模块
import VueRouter from "vue-router";

//2、完成vue的全局混合操作
import Vue from "vue";
Vue.use(VueRouter);

//引入相关页面插件，引入后App.vue中便可不再引入
import Home from "./views/home";
import Page from "./views/Page";
import Detail from "./views/filmDetail";
import NotFound from "./views/notFound";
//3、创建路由对象
const config={
    // mode:"history",
    mode:"hash",
    routes:[
        {
            path:"",
            redirect:"/home"
        },
        {
            path:"/home",
            component:Home
        },
        // {
        //     path:"/page",//get参数方式
        //     component:Page
        // }
        {
            path:"/page/:typeId?/:typeName?",
            // path:"/:typeId/page/:typeName",//若参数名称位置发生变化，对应在页面中的参数值位置也要做出相应的变化
            name:"page",
            component:Page
        },
        {
            path:"/detail",
            name:"detail",
            component:Detail,
            meta:{
                // showBottom:true
                bottomName:"bottomBar"
            }
        },
        {
            path:"*",
            component:NotFound
        }
    ]
};

const router=new VueRouter(config);

//4、将定义的路由对象进行导出
export default router;

//5、在main.js中为根实例 new Vue 添加路由对象属性